package com.student.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.student.pojo.Classes;
import com.student.service.ClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author 是一个鸽子啊
 * @date 2020/4/14
 * @qq 364826415
 */
@RestController
public class ClassesAjaxController {
    @Autowired
    @Qualifier("classesServiceImpl")
    private ClassesService classesService;
    @RequestMapping("/queryClassesByCID")
    private String queryClassesByCID(String classID) throws JsonProcessingException {
        Classes classes = classesService.queryClassesByID(Integer.parseInt(classID));
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(classes);
        return val;
    }
}
